home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Programming / MiniGL / include / mgl / gl.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-11  |  26.7 KB  |  663 lines

  1. /*
  2.  * $Id: gl.h,v 1.10 2000/03/15 17:58:19 hfrieden Exp $
  3.  *
  4.  * $Date: 2000/03/15 17:58:19 $
  5.  * $Revision: 1.10 $
  6.  *
  7.  * (C) 1999 by Hyperion
  8.  * All rights reserved
  9.  *
  10.  * This file is part of the MiniGL library project
  11.  * See the file Licence.txt for more details
  12.  *
  13.  */
  14.  
  15. #ifndef GL_H_
  16. #define GL_H_
  17.  
  18. #ifdef __cplusplus
  19. extern "C"
  20. {
  21. #endif
  22.  
  23. #if defined(__PPC__) || defined (__VBCC__) || defined(__STORM__)
  24. #define mykprintf kprintf
  25. #endif
  26.  
  27. #include "mgl/config.h"
  28. #include "mgl/log.h"
  29.  
  30. #ifndef NLOGGING
  31. extern int MGLDebugLevel;
  32. #define mglSetDebugLevel(level) \
  33.     MGLDebugLevel = level
  34. #endif
  35.  
  36. /*
  37.     GL types
  38. */
  39.  
  40. typedef void            GLvoid;
  41. typedef unsigned char   GLboolean;
  42. typedef char            GLbyte;
  43. typedef unsigned char   GLubyte;
  44. typedef short           GLshort;
  45. typedef unsigned short  GLushort;
  46. typedef int             GLint;
  47. typedef unsigned int    GLuint;
  48. typedef long            GLsizei;
  49. typedef unsigned long   GLbitfield;
  50. typedef float           GLfloat;
  51. typedef double          GLdouble;
  52. typedef float           GLclampf;
  53. typedef double          GLclampd;
  54. typedef int             GLenum;
  55.  
  56.  
  57. /*
  58.     GL enum
  59.     Currently a dummy
  60. */
  61.  
  62. enum
  63. {
  64.     GL_BASE             = 0,
  65.  
  66.     GL_ALPHA,
  67.     GL_ALPHA8,
  68.     GL_ALPHA_BITS,
  69.     GL_ALPHA_SCALE,
  70.     GL_ALPHA_TEST,
  71.     GL_ALPHA_TEST_FUNC,
  72.     GL_ALPHA_TEST_REF,
  73.     GL_ALWAYS,
  74.     GL_AUX_BUFFERS,
  75.     GL_BACK,
  76.     GL_BACK_LEFT,
  77.     GL_BACK_RIGHT,
  78.     GL_BLEND,
  79.     GL_BLEND_DST,
  80.     GL_BLEND_SRC,
  81.     GL_BLUE,
  82.     GL_BLUE_BITS,
  83.     GL_BYTE,
  84.     GL_C3F_V3F,
  85.     GL_C4UB_V2F,
  86.     GL_C4UB_V3F,
  87.     GL_CCW,
  88.     GL_COLOR_ARRAY,
  89.     GL_COLOR_ARRAY_POINTER,
  90.     GL_COLOR_ARRAY_SIZE,
  91.     GL_COLOR_ARRAY_STRIDE,
  92.     GL_COLOR_ARRAY_TYPE,
  93.     GL_COLOR_CLEAR_VALUE,
  94.     GL_COLOR_INDEX,
  95.     GL_CULL_FACE,
  96.     GL_CULL_FACE_MODE,
  97.     GL_CURRENT_COLOR,
  98.     GL_CURRENT_INDEX,
  99.     GL_CURRENT_TEXTURE_COORDS,
  100.     GL_CW,
  101.     GL_DECAL,
  102.     GL_DEPTH_BITS,
  103.     GL_DEPTH_CLEAR_VALUE,
  104.     GL_DEPTH_COMPONENT,
  105.     GL_DEPTH_FUNC,
  106.     GL_DEPTH_RANGE,
  107.     GL_DEPTH_SCALE,
  108.     GL_DEPTH_TEST,
  109.     GL_DEPTH_WRITEMASK,
  110.     GL_DITHER,
  111.     GL_DONT_CARE,
  112.     GL_DOUBLE,
  113.     GL_DOUBLEBUFFER,
  114.     GL_DRAW_BUFFER,
  115.     GL_DST_ALPHA,
  116.     GL_DST_COLOR,
  117.     GL_EDGE_FLAG,
  118.     GL_EDGE_FLAG_ARRAY,
  119.     GL_EDGE_FLAG_ARRAY_POINTER,
  120.     GL_EDGE_FLAG_ARRAY_STRIDE,
  121.     GL_EQUAL,
  122.     GL_EXTENSIONS,
  123.     GL_FASTEST,
  124.     GL_FLAT,
  125.     GL_FLOAT,
  126.     GL_FOG,
  127.     GL_FOG_COLOR,
  128.     GL_FOG_DENSITY,
  129.     GL_FOG_END,
  130.     GL_FOG_HINT,
  131.     GL_FOG_INDEX,
  132.     GL_FOG_MODE,
  133.     GL_FOG_START,
  134.     GL_FRONT_AND_BACK,
  135.     GL_FRONT,
  136.     GL_FRONT_FACE,
  137.     GL_FRONT_LEFT,
  138.     GL_FRONT_RIGHT,
  139.     GL_GEQUAL,
  140.     GL_GREATER,
  141.     GL_GREEN,
  142.     GL_GREEN_BITS,
  143.     GL_INDEX_ARRAY,
  144.     GL_INDEX_ARRAY_POINTER,
  145.     GL_INDEX_ARRAY_STRIDE,
  146.     GL_INDEX_ARRAY_TYPE,
  147.     GL_INDEX_BITS,
  148.     GL_INDEX_CLEAR_VALUE,
  149.     GL_INDEX_MODE,
  150.     GL_INT,
  151.     GL_INTENSITY,
  152.     GL_INTENSITY8,
  153.     GL_INVALID_ENUM,
  154.     GL_INVALID_OPERATION,
  155.     GL_INVALID_VALUE,
  156.     GL_LEFT,
  157.     GL_LEQUAL,
  158.     GL_LESS,
  159.     GL_LINEAR,
  160.     GL_LINEAR_MIPMAP_LINEAR,
  161.     GL_LINEAR_MIPMAP_NEAREST,
  162.     GL_LINES,
  163.     GL_LINE_LOOP,
  164.     GL_LINE_STRIP,
  165.     GL_LUMINANCE,
  166.     GL_LUMINANCE8,
  167.     GL_LUMINANCE8_ALPHA8,
  168.     GL_LUMINANCE_ALPHA,
  169.     GL_MATRIX_MODE,
  170.     GL_MAX_TEXTURE_SIZE,
  171.     GL_MAX_VIEWPORT_DIMS,
  172.     GL_MODELVIEW,
  173.     GL_MODELVIEW_MATRIX,
  174.     GL_MODELVIEW_STACK_DEPTH,
  175.     GL_MODULATE,
  176.     GL_NEVER,
  177.     GL_NEAREST,
  178.     GL_NEAREST_MIPMAP_NEAREST,
  179.     GL_NEAREST_MIPMAP_LINEAR,
  180.     GL_NICEST,
  181.     GL_NONE,
  182.     GL_NOTEQUAL,
  183.     GL_NO_ERROR,
  184.     GL_ONE,
  185.     GL_ONE_MINUS_DST_ALPHA,
  186.     GL_ONE_MINUS_DST_COLOR,
  187.     GL_ONE_MINUS_SRC_ALPHA,
  188.     GL_ONE_MINUS_SRC_COLOR,
  189.     GL_OUT_OF_MEMORY,
  190.     GL_PACK_ALIGNMENT,
  191.     GL_PACK_LSB_FIRST,
  192.     GL_PACK_ROW_LENGTH,
  193.     GL_PACK_SKIP_PIXELS,
  194.     GL_PACK_SKIP_ROWS,
  195.     GL_PACK_SWAP_BYTES,
  196.     GL_PERSPECTIVE_CORRECTION_HINT,
  197.     GL_POINTS,
  198.     GL_POLYGON_MODE,
  199.     GL_POLYGON_OFFSET,
  200.     GL_POLYGON_OFFSET_FACTOR,
  201.     GL_POLYGON_OFFSET_FILL,
  202.     GL_POLYGON_OFFSET_LINE,
  203.     GL_POLYGON_OFFSET_POINT,
  204.     GL_POLYGON_OFFSET_UNITS,
  205.     GL_POLYGON,
  206.     GL_PROJECTION,
  207.     GL_PROJECTION_MATRIX,
  208.     GL_PROJECTION_STACK_DEPTH,
  209.     GL_QUADS,
  210.     GL_QUAD_STRIP,
  211.     GL_READ_BUFFER,
  212.     GL_RED,
  213.     GL_RED_BITS,
  214.     GL_RENDERER,
  215.     GL_REPLACE,
  216.     GL_REPEAT,
  217.     GL_RGB,
  218.     GL_RGB5,
  219.     GL_RGB5_A1,
  220.     GL_RGB8,
  221.     GL_RGBA,
  222.     GL_RGBA8,
  223.     GL_RGBA_MODE,
  224.     GL_RIGHT,
  225.     GL_SCISSOR_BOX,
  226.     GL_SCISSOR_TEST,
  227.     GL_SHADE_MODEL,
  228.     GL_SHORT,
  229.     GL_SMOOTH,
  230.     GL_SRC_ALPHA,
  231.     GL_SRC_ALPHA_SATURATE,
  232.     GL_SRC_COLOR,
  233.     GL_STACK_OVERFLOW,
  234.     GL_STACK_UNDERFLOW,
  235.     GL_STEREO,
  236.     GL_T2F_C3F_V3F,
  237.     GL_T2F_C4UB_V3F,
  238.     GL_T2F_V3F,
  239.     GL_TABLE_TOO_LARGE,
  240.     GL_TEXTURE_2D,
  241.     GL_TEXTURE_2D_BINDING,
  242.     GL_TEXTURE_COORD_ARRAY,
  243.     GL_TEXTURE_COORD_ARRAY_SIZE,
  244.     GL_TEXTURE_COORD_ARRAY_STRIDE,
  245.     GL_TEXTURE_COORD_ARRAY_TYPE,
  246.     GL_TEXTURE_DOOR_ARRAY_POINTER,
  247.     GL_TEXTURE_ENV,
  248.     GL_TEXTURE_ENV_COLOR,
  249.     GL_TEXTURE_ENV_MODE,
  250.     GL_TEXTURE_MAG_FILTER,
  251.     GL_TEXTURE_MIN_FILTER,
  252.     GL_TEXTURE_PRIORITY,
  253.     GL_TEXTURE_WRAP_S,
  254.     GL_TEXTURE_WRAP_T,
  255.     GL_TEXTURE_GEN_S,
  256.     GL_TEXTURE_GEN_T,
  257.     GL_TRIANGLES,
  258.     GL_TRIANGLE_FAN,
  259.     GL_TRIANGLE_STRIP,
  260.     GL_UNPACK_ALIGNMENT,
  261.     GL_UNPACK_LSB_FIRST,
  262.     GL_UNPACK_ROW_LENGTH,
  263.     GL_UNPACK_SKIP_PIXELS,
  264.     GL_UNPACK_SKIP_ROWS,
  265.     GL_UNPACK_SWAP_BYTES,
  266.     GL_UNSIGNED_BYTE,
  267.     GL_UNSIGNED_INT,
  268.     GL_UNSIGNED_SHORT,
  269.     GL_V2F,
  270.     GL_V3F,
  271.     GL_VENDOR,
  272.     GL_VERSION,
  273.     GL_VERTEX_ARRAY,
  274.     GL_VERTEX_ARRAY_POINTER,
  275.     GL_VERTEX_ARRAY_SIZE,
  276.     GL_VERTEX_ARRAY_STRIDE,
  277.     GL_VERTEX_ARRAY_TYPE,
  278.     GL_VIEWPORT,
  279.     GL_ZERO,
  280.     GL_POINT_SMOOTH,
  281.     GL_CLAMP,
  282.     GL_EXP,
  283.     GL_EXP2,
  284.     GL_TEXTURE_GEN_MODE,
  285.     GL_SPHERE_MAP,
  286.     GL_T,
  287.     GL_S,
  288.     GL_FILL,
  289. #ifdef AUTOMATIC_LOCKING_ENABLE
  290.     MGL_LOCK_AUTOMATIC,
  291.     MGL_LOCK_MANUAL,
  292.     MGL_LOCK_SMART,
  293. #endif
  294.     MGL_FLATFAN,
  295.     MGL_PERSPECTIVE_MAPPING,
  296.     MGL_W_ONE_HINT,
  297.     MGL_Z_OFFSET,
  298.     GL_COLOR_TABLE,
  299. };
  300.  
  301. #define GL_COLOR_BUFFER_BIT     0x00000001
  302. #define GL_DEPTH_BUFFER_BIT     0x00000002
  303.  
  304. #define GL_TRUE                 1
  305. #define GL_FALSE                0
  306.  
  307. #define MGL_BUTTON_LEFT         0x00000001
  308. #define MGL_BUTTON_RIGHT        0x00000002
  309. #define MGL_BUTTON_MID          0x00000004
  310.  
  311. #define MGL_SM_BESTMODE         0xFFFFFFFF
  312. #define MGL_SM_WINDOWMODE       0x00000000
  313.  
  314. typedef struct MGLColor_t
  315. {
  316.     GLfloat r,g,b,a;
  317. } MGLColor;
  318.  
  319. typedef struct MGLNormal_t
  320. {
  321.     GLfloat x,y,z;
  322. } MGLNormal;
  323.  
  324. #include "mgl/vertexbuffer.h"
  325. #include "mgl/context.h"
  326. #include "mgl/clip.h"
  327. #include "mgl/modes.h"
  328.  
  329. /*
  330.     The current context is refered to as an extern variable, which
  331.     is a pointer to the context.
  332. */
  333.  
  334. extern GLcontext mini_CurrentContext;
  335.  
  336. #ifndef GLNDEBUG
  337.     #define GLASSERT(c) assert(c)
  338.     #define dprintf(x) printf x
  339. #else
  340.     #define GLASSERT(c)
  341.     #define dprintf(x)
  342. #endif
  343.  
  344. #ifndef GL_NOERRORCHECK
  345.     extern int kprintf(char *, ...);
  346.     #define GLFlagError(context,c,err) while ((c)) {\
  347.         context->CurrentError = err;\
  348.         kprintf("GLError: %ld at %s:%ld\n", (int)err, __FILE__,(int)__LINE__);\
  349.         return;\
  350.     }
  351. #else
  352.     #define GLFlagError(context,c,err)
  353. #endif
  354.  
  355.  
  356. /*
  357.     Prototypes and appropriate defines
  358.     These are derived from the OpenGL manpages
  359.     Some defines are duplicated with EXT suffix, to be compatible.
  360.     Additionally, some of these may not be needed (Maybe glBegin).
  361.     There may also be a problem with floating point parameters for
  362.     certain compilers. May be addressed in the macros.
  363. */
  364.  
  365. void        GLAlphaFunc(GLcontext context, GLenum func, GLclampf ref);
  366. //GLboolean   GLAreTexturesResident(GLcontext context, GLsizei n, const GLuint *textures, GLboolean *residences);
  367. //void        GLArrayElement(GLcontext context, GLint i);
  368. void        GLBegin(GLcontext context, GLenum mode);
  369. void        GLBindTexture(GLcontext context, GLenum target, GLuint texture);
  370. void        GLBlendFunc(GLcontext context, GLenum sfactor, GLenum dfactor);
  371. void        GLClear(GLcontext context, GLbitfield mask);
  372. void        GLClearColor(GLcontext context, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  373. void        GLClearDepth(GLcontext context, GLclampd depth);
  374. void        GLColor3fv(GLcontext context, GLfloat *v);
  375. void        GLColor3ubv(GLcontext context, GLubyte *v);
  376. void        GLColor4f(GLcontext context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
  377. void        GLColor4fv(GLcontext context, GLfloat *v);
  378. void        GLColor4ub(GLcontext context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alhpa);
  379. void        GLColor4ubv(GLcontext context, GLubyte *v);
  380. //void        GLColorPointer(GLcontext context, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  381. void        GLColorTable(GLcontext context, GLenum target, GLenum internalformat, GLint width, GLenum format, GLenum type, GLvoid *data);
  382. void        GLCullFace(GLcontext context, GLenum mode);
  383. void        GLDeleteTextures(GLcontext context, GLsizei n, const GLuint *textures);
  384. void        GLDepthFunc(GLcontext context, GLenum func);
  385. void        GLDepthMask(GLcontext context, GLboolean flag);
  386. void        GLDepthRange(GLcontext context, GLclampd n, GLclampd f);
  387. //void        GLDisableClientState(GLcontext context, GLenum cap);
  388. //void        GLDrawArrays(GLcontext context, GLenum mode, GLint first, GLsizei count);
  389. void        GLDrawBuffer(GLcontext context, GLenum mode);
  390. //void        GLDrawElements(GLcontext context, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
  391. //void        GLEdgeFlag(GLcontext context, GLboolean flag);
  392. //void        GLEdgeFlagPointer(GLcontext context, GLsizei stride, const GLboolean *flags);
  393. //void        GLEdgeFlagv(GLcontext context, const GLboolean *flag);
  394. //void        GLEnableClientState(GLcontext context, GLenum cap);
  395. void        GLEnd(GLcontext context);
  396. void        GLFinish(GLcontext context);
  397. void        GLFlush(GLcontext context);
  398. void        GLFogf(GLcontext context, GLenum pname, GLfloat param);
  399. void        GLFogfv(GLcontext context, GLenum pname, GLfloat *param);
  400. void        GLFrontFace(GLcontext context, GLenum mode);
  401. void        GLFrustum(GLcontext context, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
  402. void        GLGenTextures(GLcontext context, GLsizei n, GLuint *textures);
  403. //void        GLGetBooleanv(GLcontext context, GLenum pname, GLboolean *params);
  404. //void        GLGetDoublev(GLcontext context, GLenum pname, GLdouble *params);
  405. GLenum      GLGetError(GLcontext context);
  406. void        GLGetFloatv(GLcontext context, GLenum pname, GLfloat *params);
  407. void        GLGetIntegerv(GLcontext context, GLenum pname, GLint *params);
  408. void        GLGetPointerv(GLcontext context, GLenum pname, GLvoid* *params);
  409. const GLubyte* GLGetString(GLcontext context, GLenum name);
  410. void        GLHint(GLcontext context, GLenum target, GLenum mode);
  411. //void        GLIndexi(GLcontext context, GLint c);
  412. //void        GLIndexiv(GLcontext context, const GLint *c);
  413. //void        GLIndexPointer(GLcontext context, GLenum type, GLsizei stride, const GLvoid *pointer);
  414. //void        GLInterleavedArrays(GLcontext context, GLenum format, GLsizei stride, const GLvoid *pointer);
  415. //GLboolean   GLIsEnabled(GLcontext context, GLenum cap);
  416. //GLboolean   GLIsTexture(GLcontext context, GLuint texture);
  417. void        GLLoadIdentity(GLcontext context);
  418. void        GLLoadMatrixd(GLcontext context, const GLdouble *m);
  419. void        GLLoadMatrixf(GLcontext context, const GLfloat *m);
  420. void        GLMatrixMode(GLcontext context, GLenum mode);
  421. void        GLMultMatrixd(GLcontext context, const GLdouble *m);
  422. void        GLMultMatrixf(GLcontext context, const GLfloat *m);
  423. void        GLNormal3f(GLcontext context, GLfloat x, GLfloat y, GLfloat z);
  424. void        GLOrtho(GLcontext context, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
  425. void        GLPixelStorei(GLcontext context, GLenum pname, GLint param);
  426. void        GLPolygonMode(GLcontext context, GLenum face, GLenum mode);
  427. //void        GLPolygonOffset(GLcontext context, GLfloat factor, GLfloat units);
  428. void        GLPopMatrix(GLcontext context);
  429. //void        GLPrioritizeTextures(GLcontext context, GLsizei n, const GLuint *textures, const GLclampf *priorities);
  430. void        GLPushMatrix(GLcontext context);
  431. //void        GLReadBuffer(GLcontext context, GLenum mode);
  432. void        GLReadPixels(GLcontext context, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
  433. void        GLRotated(GLcontext context, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
  434. void        GLRotatef(GLcontext context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
  435. void        GLScaled(GLcontext context, GLdouble x, GLdouble y, GLdouble z);
  436. void        GLScalef(GLcontext context, GLfloat x, GLfloat y, GLfloat z);
  437. void        GLScissor(GLcontext context, GLint x, GLint y, GLsizei width, GLsizei height);
  438. void        GLShadeModel(GLcontext context, GLenum mode);
  439. void        GLTexCoord2f(GLcontext context, GLfloat s, GLfloat t);
  440. void        GLTexCoord2fv(GLcontext context, GLfloat *v);
  441. //void        GLTexCoordPointer(GLcontext context, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  442. void        GLTexEnvi(GLcontext context, GLenum target, GLenum pname, GLint param);
  443. void        GLTexGeni(GLcontext context, GLenum coord, GLenum mode, GLenum map);
  444. void        GLTexImage2D(GLcontext context, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
  445. void        GLTexParameteri(GLcontext context, GLenum target, GLenum pname, GLint param);
  446. void        GLTexSubImage2D(GLcontext context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
  447. void        GLTranslated(GLcontext context, GLdouble x, GLdouble y, GLdouble z);
  448. void        GLTranslatef(GLcontext context, GLfloat x, GLfloat y, GLfloat z);
  449. void        GLVertex3fv(GLcontext context, GLfloat *v);
  450. void        GLVertex4f(GLcontext context, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
  451. void        GLVertex4fv(GLcontext context, GLfloat *v);
  452. //void        GLVertexPointer(GLcontext context, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  453. void        GLViewport(GLcontext context, GLint x, GLint y, GLsizei width, GLsizei height);
  454. void        mglChooseNumberOfBuffers(int number);
  455. void        mglChoosePixelDepth(int depth);
  456. void        mglChooseTextureBufferSize(int size);
  457. void        mglChooseVertexBufferSize(int size);
  458. void        mglChooseWindowMode(GLboolean flag);
  459. void *      MGLCreateContext(int offx, int offy, int w, int h);
  460. void        MGLDeleteContext(GLcontext context);
  461. void        MGLEnableSync(GLcontext context, GLboolean enable);
  462. void        MGLExit(GLcontext context);
  463. void *      MGLGetWindowHandle(GLcontext context);
  464. void        MGLIdleFunc(GLcontext context, IdleFn i);
  465. void        MGLKeyFunc(GLcontext context, KeyHandlerFn k);
  466. GLboolean   MGLLockDisplay(GLcontext context);
  467. void        MGLMainLoop(GLcontext context);
  468. void        MGLMouseFunc(GLcontext context, MouseHandlerFn m);
  469. void        mglProhibitAlphaFallback(GLboolean flag);
  470. void        mglProhibitMipMapping(GLboolean flag);
  471. void        mglProposeCloseDesktop(GLboolean closeme);
  472. void        MGLResizeContext(GLcontext context, GLsizei width, GLsizei height);
  473. void        MGLSetState(GLcontext context, GLenum cap, GLboolean state);
  474. void        MGLSpecialFunc(GLcontext context, SpecialHandlerFn s);
  475. void        MGLSwitchBuffer(GLcontext context, int bufnr);
  476. void        MGLSwitchDisplay(GLcontext context);
  477. void        MGLTexMemStat(GLcontext context, GLint *Current, GLint *Peak);
  478. void        MGLUnlockDisplay(GLcontext context);
  479. void        MGLWriteShotPPM(GLcontext context, char *filename);
  480. void        MGLInit(void);
  481. void        MGLTerm(void);
  482.  
  483. #ifdef AUTOMATIC_LOCKING_ENABLE
  484. void        MGLLockMode(GLcontext context, GLenum lockMode);
  485. #endif
  486.  
  487. void        MGLPrintMatrix(GLcontext context, int mode);
  488. void        MGLPrintMatrixStack(GLcontext context, int mode);
  489.  
  490. void        MGLSetZOffset(GLcontext context, GLfloat offset);
  491.  
  492. void        GLULookAt(GLfloat ex, GLfloat ey, GLfloat ez, GLfloat cx, GLfloat cy, GLfloat cz, GLfloat ux, GLfloat uy, GLfloat uz);
  493. void        GLUPerspective(GLfloat fovy, GLfloat aspect, GLfloat znear, GLfloat zfar);
  494.  
  495. GLint       mglGetSupportedScreenModes(MGLScreenModeCallback CallbackFn);
  496. void *      MGLCreateContextFromID(GLint ID, GLint *w, GLint *h);
  497. GLboolean   MGLLockBack(GLcontext context, MGLLockInfo *info);
  498.  
  499. /*
  500. ** These macros define the OpenGL compatibility macros. If you don't want them,
  501. ** define NO_GL_MACROS before including this file. In this case, you might
  502. ** define the USE_GL_INLINES to include static inline functions that do the same.
  503. */
  504.  
  505. #ifdef NO_GL_MACROS
  506. #ifdef USE_GL_INLINES
  507. #include "mgl/minigl.h"
  508. #endif
  509. #else
  510. #define glAlphaFunc(func, ref) GLAlphaFunc(mini_CurrentContext, func, ref)
  511. #define glAreTexturesResident(n, textures, residences) GLAreTexturesResident(mini_CurrentContext, n, textures, residences)
  512. #define glArrayElement(i) GLArrayElement(mini_CurrentContext, i)
  513. #define glArrayElementEXT(i) GLArrayElement(mini_CurrentContext, i)
  514. #define glBegin(mode) GLBegin(mini_CurrentContext, mode)
  515. #define glEnd() GLEnd(mini_CurrentContext)
  516. #define glTexGeni(coord,mode,map) GLTexGeni(mini_CurrentContext, coord, mode, map)
  517. #define glBindTexture(target, texture) GLBindTexture(mini_CurrentContext, target, texture)
  518. #define glBlendFunc(sfactor, dfactor) GLBlendFunc(mini_CurrentContext, sfactor, dfactor)
  519. #define glClear(mask) GLClear(mini_CurrentContext, mask)
  520. #define glClearColor(red, green, blue, alpha) GLClearColor(mini_CurrentContext, red, green, blue, alpha)
  521. #define glClearDepth(depth) GLClearDepth(mini_CurrentContext, depth)
  522. #define glColorPointer(size, type, stride, pointer) GLColorPointer(mini_CurrentContext, size, type, stride, pointer)
  523. #define glColorPointerEXT(size, type, stride, pointer) GLColorPointer(mini_CurrentContext, size, type, stride, pointer)
  524. #define glColorTable(target, internalformat, width, format, type, data) GLColorTable(mini_CurrentContext, target, internalformat, width, format, type, data)
  525. #define glCullFace(mode) GLCullFace(mini_CurrentContext, mode)
  526. #define glDeleteTextures(n, textures) GLDeleteTextures(mini_CurrentContext, n, textures)
  527. #define glDepthFunc(func) GLDepthFunc(mini_CurrentContext, func)
  528. #define glDepthMask(flag) GLDepthMask(mini_CurrentContext, flag)
  529. #define glEnable(cap) MGLSetState(mini_CurrentContext, cap, GL_TRUE)
  530. #define glDisable(cap) MGLSetState(mini_CurrentContext, cap, GL_FALSE)
  531. #define glDisableClientState(cap) GLDisableClientState(mini_CurrentContext, cap)
  532. #define glEnableClientState(cap) GLEnableClienState(mini_CurrentContext, cap)
  533. #define glDrawArrays(mode, first, count) GLDrawArrays(mini_CurrentContext, mode, first, count)
  534. #define glDrawArraysEXT(mode, first, count) GLDrawArrays(mini_CurrentContext, mode, first, count)
  535. #define glDrawBuffer(mode) GLDrawBuffer(mini_CurrentContext, mode)
  536. #define glDrawElements(mode, count, type, indices) GLDrawElements(mini_CurrentContext, mode, count, type, indices)
  537. #define glEdgeFlag(flag) GLEdgeFlag(mini_CurrentContext, flag)
  538. #define glEdgeFlagv(flag) GLEdgeFlagv(mini_CurrentContext, flag)
  539. #define glEdgeFlagPointer(stride, flags) GLEdgeFlagPointer(mini_CurrentContext, stride, flags)
  540. #define glEdgeFlagPointerEXT(stride, flags) GLEdgeFlagPointer(mini_CurrentContext, stride, flags)
  541. #define glFinish() GLFinish(mini_CurrentContext)
  542. #define glFlush() GLFlush(mini_CurrentContext)
  543. #define glFogf(pname, param) GLFogf(mini_CurrentContext, pname, param)
  544. #define glFogfv(pname, param) GLFogfv(mini_CurrentContext, pname, param)
  545. #define glFogi(pname, param) glFogf(pname, (GLfloat)param)
  546. #define glFrontFace(mode) GLFrontFace(mini_CurrentContext, mode)
  547. #define glFrustum(left, right, bottom, top, zNear, zFar) GLFrustum(mini_CurrentContext, left, right, bottom, top, zNear, zFar)
  548. #define glGenTextures(n, textures) GLGenTextures(mini_CurrentContext, n, textures)
  549. #define glGetError() GLGetError(mini_CurrentContext)
  550. #define glGetBooleanv(pname, params) GLGetBooleanv(mini_CurrentContext, pname, params);
  551. #define glGetDoublev(pname, params) GLGetDoublev(mini_CurrentContext, pname, params)
  552. #define glGetFloatv(pname, params) GLGetFloatv(mini_CurrentContext, pname, params)
  553. #define glGetIntegerv(pname, params) GLGetIntegerv(mini_CurrentContext, pname, params)
  554. #define glGetPointerv(pname, params) GLGetPointerv(mini_CurrentContext, pname, params)
  555. #define glGetPointervEXT(pname, params) GLGetPointerv(mini_CurrentContext, pname, params)
  556. #define glGetString(name) GLGetString(mini_CurrentContext, name)
  557. #define glHint(target, mode) GLHint(mini_CurrentContext, target, mode)
  558. #define glIndexi(c) GLIndexi(mini_CurrentContext, c)
  559. #define glIndexiv(c) GLIndexfv(mini_CurrentContext, c)
  560. #define glIndexPointer(type, stride, pointer) GLIndexPointer(mini_CurrentContext, type, stride, pointer)
  561. #define glIndexPointerEXT(type, stride, pointer) GLIndexPointer(mini_CurrentContext, type, stride, pointer)
  562. #define glInterleavedArrays(format, stride, pointer) GLInterleavedArrays(mini_CurrentContext, format, stride, pointer)
  563. #define glIsEnabled(cap) GLIsEnabled(mini_CurrentContext, cap)
  564. #define glIsTexture(texture) GLIsTexture(mini_CurrentContext, texture)
  565. #define glLoadIdentity() GLLoadIdentity(mini_CurrentContext)
  566. #define glLoadMatrixf(m) GLLoadMatrixf(mini_CurrentContext, m)
  567. #define glLoadMatrixd(m) GLLoadMatrixd(mini_CurrentContext, m)
  568. #define glMatrixMode(mode) GLMatrixMode(mini_CurrentContext, mode)
  569. #define glMultMatrixd(m) GLMultMatrixd(mini_CurrentContext, m)
  570. #define glMultMatrixf(m) GLMultMatrixf(mini_CurrentContext, m)
  571. #define glOrtho(left, right, bottom, top, zNear, zFar) GLOrtho(mini_CurrentContext, left, right, bottom, top, zNear, zFar)
  572. #define glPixelStorei(pname, param) GLPixelStorei(mini_CurrentContext, pname, param)
  573. #define glPixelStoref(pname, param) GLPixelStorei(mini_CurrentContext, pname, (int)(param))
  574. #define glPolygonMode(face, mode) GLPolygonMode(mini_CurrentContext, face, mode)
  575. #define glPolygonOffset(factor, units) GLPolygonOffset(mini_CurrentContext, factor, units)
  576. #define glPushMatrix() GLPushMatrix(mini_CurrentContext)
  577. #define glPopMatrix() GLPopMatrix(mini_CurrentContext)
  578. #define glPrioritizeTextures(n, textures, pri) GLPrioritizeTextures(mini_CurrentContext, n, textures, pri)
  579. #define glReadBuffer(mode) GLReadBuffer(mini_CurrentContext, mode)
  580. #define glReadPixels(x, y, width, height, format, type, pixels) GLReadPixels(mini_CurrentContext, x, y, width, height, format, type, pixels)
  581. #define glRotated(angle, x, y, z) GLRotated(mini_CurrentContext, angle, x, y, z)
  582. #define glRotatef(angle, x, y, z) GLRotatef(mini_CurrentContext, (angle), (x), (y), (z))
  583. #define glScaled(x, y, z) GLScaled(mini_CurrentContext, x, y, z)
  584. #define glScalef(x, y, z) GLScaled(mini_CurrentContext, (GLdouble)(x), (GLdouble)(y), (GLdouble)(z))
  585. #define glScissor(x, y, w, h) GLScissor(mini_CurrentContext, x, y, w, h)
  586. #define glShadeModel(mode) GLShadeModel(mini_CurrentContext, mode)
  587. #define glTexCoord2f(s, t) GLTexCoord2f(mini_CurrentContext, s, t)
  588. #define glTexCoord2fv(v) GLTexCoord2fv(mini_CurrentContext, v)
  589. #define glTexCoordPointer(size, type, stride, pointer) GLTexCoordPointer(mini_CurrentContext, size, type, stride, pointer)
  590. #define glTexCoordPointerEXT(size, type, stride, pointer) GLTexCoordPointer(mini_CurrentContext, size, type, stride, pointer)
  591. #define glTexImage2D(target, level, internal, width, height, border, format, type, pixels) GLTexImage2D(mini_CurrentContext, target, level, internal, width, height, border, format, type, pixels)
  592. #define glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels) GLTexSubImage2D(mini_CurrentContext, target, level, xoffset, yoffset, width, height, format, type, pixels)
  593. #define glTranslated(x, y, z) GLTranslated(mini_CurrentContext, x, y, z)
  594. #define glTranslatef(x, y, z) GLTranslatef(mini_CurrentContext, x, y, z)
  595. #define glViewport(x, y, width, height) GLViewport(mini_CurrentContext, x, y, width, height)
  596. #define glVertex4f(x,y,z,w) GLVertex4f(mini_CurrentContext, x,y,z,w)
  597. #define glVertex2f(x,y)     GLVertex4f(mini_CurrentContext, x,y, 0.f, 1.f)
  598. #define glVertex2i(x,y)     GLVertex4f(mini_CurrentContext, (GLfloat)x, (GLfloat)y, 0.f, 1.f)
  599. #define glVertex3f(x,y,z)   GLVertex4f(mini_CurrentContext, x,y,z,    1.f)
  600. #define glVertex3fv(v)      GLVertex3fv(mini_CurrentContext, v);
  601. #define glVertexPointer(size, type, stride, pointer) GLVertexPointer(mini_CurrentContext, size, type, stride, pointer)
  602. #define glVertexPointerEXT(size, type, stride, pointer) GLVertexPointer(mini_CurrentContext, size, type, stride, pointer)
  603. #define glDepthRange(n,f) GLDepthRange(mini_CurrentContext, n,f)
  604. #define mglCreateContext(offx, offy, w, h) mini_CurrentContext = MGLCreateContext(offx, offy, w,h)
  605. #define mglResizeContext(width, height) MGLResizeContext(mini_CurrentContext, width, height)
  606. #define mglSwitchBuffer(bufnr) MGLSwitchBuffer(mini_CurrentContext, bufnr)
  607. #define mglDeleteContext() MGLDeleteContext(mini_CurrentContext)
  608. #define mglGetWindowHandle() MGLGetWindowHandle(mini_CurrentContext)
  609. #define mglSwitchDisplay() MGLSwitchDisplay(mini_CurrentContext)
  610. #define mglLockDisplay() MGLLockDisplay(mini_CurrentContext)
  611. #define mglUnlockDisplay() MGLUnlockDisplay(mini_CurrentContext)
  612. #define glColor4f(red, green, blue, alpha)  GLColor4f(mini_CurrentContext, red, green, blue, alpha)
  613. #define glColor4fv(v)                       GLColor4fv(mini_CurrentContext, v)
  614. #define glColor3f(red,green,blue)           GLColor4f(mini_CurrentContext, red, green, blue, 1.0)
  615. #define glColor3fv(v)                       GLColor3fv(mini_CurrentContext,v)
  616. #define glColor4ub(r,g,b,a) GLColor4ub(mini_CurrentContext, r,g,b,a)
  617. #define glColor4ubv(v)      GLColor4ubv(mini_CurrentContext, v)
  618. #define glColor3ub(r,g,b)   GLColor4ub(mini_CurrentContext, r,g,b,255)
  619. #define glColor3ubv(v)      GLColor4ub(mini_CurrentContext, v)
  620. #define glNormal3f(x,y,z) GLNormal3f(mini_CurrentContext, x,y,z)
  621. #define glTexEnvi(target, pname, param) GLTexEnvi(mini_CurrentContext, target, pname, param)
  622. #define glTexEnvf(target, pname, param)  GLTexEnvi(mini_CurrentContext, target, pname, (GLint)param)
  623. #define glTexEnviv(target, pname, param) glTexEnvi(target, pname, *(param))
  624. #define glTexEnvfv(target, pname, param) glTexEnvi(target, pname, (GLint)(*(param)))
  625. #define glTexParameteri(target, pname, param) GLTexParameteri(mini_CurrentContext, target, pname, param)
  626. #define glTexParameterf(target, pname, param) glTexParameteri(target, pname, (GLint)param)
  627. #define glTexParameteriv(target, pname, param) glTexParameteri(target, pname, *(param))
  628. #define glTexParameterfv(target, pname, param) glTexParameteri(target, pname, (GLint)*(param))
  629. #define mglEnableSync(enable) MGLEnableSync(mini_CurrentContext, enable)
  630. #define mglWriteShotPPM(filename) MGLWriteShotPPM(mini_CurrentContext, filename)
  631. #define mglTexMemStat(Current, Peak) MGLTexMemStat(mini_CurrentContext, Current, Peak)
  632. #define mglCreateContextFromID(ID, w, h) MGLCreateContextFromID(ID, w, h)
  633. #define mglLockBack(info) MGLLockBack(mini_CurrentContext, info)
  634.  
  635. #ifdef AUTOMATIC_LOCKING_ENABLE
  636. #define mglLockMode(lockMode) MGLLockMode(mini_CurrentContext, lockMode)
  637. #endif
  638.  
  639. #define mglKeyFunc(k) MGLKeyFunc(mini_CurrentContext, k)
  640. #define mglSpecialFunc(s) MGLSpecialFunc(mini_CurrentContext, s)
  641. #define mglMouseFunc(m) MGLMouseFunc(mini_CurrentContext, m)
  642. #define mglIdleFunc(i) MGLIdleFunc(mini_CurrentContext, i)
  643.  
  644. #define mglExit() MGLExit(mini_CurrentContext)
  645. #define mglMainLoop() MGLMainLoop(mini_CurrentContext)
  646.  
  647. #ifndef GLNDEBUG
  648. #define mglPrintMatrix(mode) MGLPrintMatrix(mini_CurrentContext, mode)
  649. #define mglPrintMatrixStack(mode) MGLPrintMatrixStack(mini_CurrentContext, mode)
  650. #endif
  651.  
  652. #define gluLookAt(ex, ey, ez, cx, cy, cz, ux, uy, uz) GLULookAt(ex, ey, ez, cx, cy, cz, ux, uy, uz);
  653. #define gluPerspective(fovy, aspect, znear, zfar) GLUPerspective(fovy, aspect, znear, zfar);
  654.  
  655. #endif
  656.  
  657. #ifdef __cplusplus
  658. }
  659. #endif
  660.  
  661.  
  662. #endif
  663.